<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>林森森不见鹿</li>
        <li>林森森不见鹿</li>
        <li>林森森不见鹿</li>
        <li>林森森不见鹿</li>
        <li>林森森不见鹿</li>
    </ul>
    <script>
        //给ul绑定事件，实现li点谁谁变色
        var ul = document.querySelector('ul');
        ul.addEventListener('click',function(e){
            //排他思想
            var lis = ul.children;
            for(var i = 0;i < lis.length;i++){
                lis[i].style.backgroundColor = '';
            }
            //获取当前被点击的li
            e.target.style.backgroundColor = '#bfa';
        });
    </script>
</body>
</html>